package team.bluepen.order;

import team.bluepen.order.constant.ErrorCode;

/**
 * @author RollW
 */
public class ErrorPack {
    private ErrorCode errorCode;
    private String message;

    public ErrorPack(ErrorCode errorCode, String message) {
        this.errorCode = errorCode;
        this.message = message;
    }

    public ErrorCode getErrorCode() {
        return errorCode;
    }

    public ErrorPack setErrorCode(ErrorCode errorCode) {
        this.errorCode = errorCode;
        return this;
    }

    public String getMessage() {
        return message;
    }

    public ErrorPack setMessage(String message) {
        this.message = message;
        return this;
    }

    public ErrorCodePack toCodePack() {
        return new ErrorCodePack(errorCode.getValue(), message);
    }

    public static class ErrorCodePack {
        public final String errorCode;
        public final String message;

        public ErrorCodePack(String errorCode, String message) {
            this.errorCode = errorCode;
            this.message = message;
        }
    }

    @Override
    public String toString() {
        return "ErrorPack{" +
                "errorCode=" + errorCode +
                ", message='" + message + '\'' +
                '}';
    }
}
